<include file="Admin:header" />

<table  class="search_table" width="100%">
	<tr>
		<td class="search">
			<form action="{:U($module_name.'/index')}" method="get" <?php if($_REQUEST['startdate']){ ?> style="display:none;" <?php } ?> id="form_ordinary">
			<input type="hidden" name="g" value="{$Think.GROUP_NAME}" />
			<input type="hidden" name="m" value="{$Think.MODULE_NAME}" />
			<input type="hidden" name="a" value="{$Think.ACTION_NAME}" />

			<input id="title" type="text" class="input-text" name="keyword" value="{$Think.get.keyword}" />
			<select name="searchtype">
			<option value="title" <eq name="searchtype" value='title'>selected="selected"</eq>>收货编码</option>
			<option value="suppliername" <eq name="searchtype" value='suppliername'>selected="selected"</eq>>供应商名称</option>
			<option value="handling" <eq name="searchtype" value='handing'>selected="selected"</eq>>经手人</option>
			<option value="id" <eq name="searchtype" value='id'>selected="selected"</eq>>ID</option>
			</select>

			<select name="sort">
				<option value="asc" <if condition="$sort =='asc'">selected="selected"</if>>{:L('order_by_asc')}</option>
				<option value="desc" <if condition="$sort =='desc'">selected="selected"</if>>{:L('order_by_desc')}</option>
			</select>

			<select name="listRows">
				<option value="15" <if condition="$listRows ==5">selected="selected"</if>>15{:L('listRows')}</option>
				<option value="20" <if condition="$listRows ==20">selected="selected"</if>>20{:L('listRows')}</option>
				<option value="50" <if condition="$listRows ==50">selected="selected"</if>>50{:L('listRows')}</option>
				<option value="100" <if condition="$listRows ==100">selected="selected"</if>>100{:L('listRows')}</option>
			</select>

			<input type="hidden" id="menuid" name="menuid" value="{$_GET['menuid']}"/>
			<input type="submit" value="{:L('chaxun')}"  class="button" />
			<input type="reset" value="{:L('reset')}" class="button"  />
			<input type="button" value="高级" class="button" OnClick="$('#form_advanced').show();$('#form_ordinary').hide();" />
			</form>



			<form action="{:U($module_name.'/index')}" method="get" <?php if(!$_REQUEST['startdate']){ ?> style="display:none;" <?php } ?> id="form_advanced">
			<input type="hidden" name="g" value="{$Think.GROUP_NAME}" />
			<input type="hidden" name="m" value="{$Think.MODULE_NAME}" />
			<input type="hidden" name="a" value="{$Think.ACTION_NAME}" />

<input  class="Wdate input-text"  name="startdate" type="text" id="startdate" size="25" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="<?php echo date('Y-m-d H:i:s'); ?>" />至
<input  class="Wdate input-text"  name="enddate" type="text" id="enddate" size="25" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="<?php echo date('Y-m-d H:i:s'); ?>" />

			<select name="suppliername">
			<option value="">供应商</option>
<volist name="Suppliermo" id="r">
<option value="{$r['title']}" <eq name="suppliername" value="$r['title']">selected="selected"</eq>>{$r['title']}</option>
</volist>
			</select>
			<select name="sort">
				<option value="asc" <if condition="$sort =='asc'">selected="selected"</if>>{:L('order_by_asc')}</option>
				<option value="desc" <if condition="$sort =='desc'">selected="selected"</if>>{:L('order_by_desc')}</option>
			</select>

			<select name="listRows">
				<option value="15" <if condition="$listRows ==5">selected="selected"</if>>15{:L('listRows')}</option>
				<option value="20" <if condition="$listRows ==20">selected="selected"</if>>20{:L('listRows')}</option>
				<option value="50" <if condition="$listRows ==50">selected="selected"</if>>50{:L('listRows')}</option>
				<option value="100" <if condition="$listRows ==100">selected="selected"</if>>100{:L('listRows')}</option>
			</select>

			<input type="hidden" id="menuid" name="menuid" value="{$_GET['menuid']}"/>
			<input type="submit" value="{:L('chaxun')}"  class="button" />
			<input type="reset" value="{:L('reset')}" class="button"  />
			<input type="button" value="普通" class="button"  OnClick="$('#form_advanced').hide();$('#form_ordinary').show();" />
			</form>
		</td>

	</tr>
</table>



<form name="myform" id="myform" action="" method="post">

<div class="table-list">
    <table width="100%" cellspacing="0">
		<thead>
            <tr>
			<th width="30"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');"></th>
            <th width="40">ID</th>
			<th>收货编码</th>
			<th>供应商名称</th>
			<th>总价</th>
			<th>经手人</th>
			<th>同步</th>
            <th width="120">{:L('createtime')}</th>
			<th width="72">{:L('manage')}</th>
            </tr>
        </thead>
      	<tbody>
      		<volist name="list" id="vo" key="k">
      		<tr align="center">
			<td align="center"><input class="inputcheckbox " name="ids[]" value="{$vo['id']}" type="checkbox" ></td>
			<td align="center">{$vo['id']}</td>
      		<td><a href="#" onclick="showsublist({$vo['id']});return false;">{$vo['title']}</a></td>
      		<td>{$vo['suppliername']} </td>
      		<td>{$vo['price']|number_format=###,2}</td>
      		<td>{$vo['handling']} </td>
      		<td>{$vo['syn']} </td>
      		<td align="center"><a class="dateformat" title="{$vo['createtime']|todate='Y-m-d H:i:s'}">{$vo['createtime']|todate="Y-m-d"}</a></td>
			<td align="center"><a href="javascript:confirm_delete('{:U($module_name.'/delete',array(id=>$vo['id']))}')">{:L('delete')}</a></td>
      		</tr>
			<tr style="display:none;" id="mo_{$vo['id']}">
				<td></td><td></td><td colspan="20">
					<table>
						<tr>
							<td>产品编码</td><td>规格型号</td><td>数量</td><td>价格</td><td>总价</td>
						</tr>
						<volist name="vo['sublist']" id="voo">
						<tr>
							<td>{$voo['productcode']}</td><td>{$voo['guige']}</td><td>{$voo['number']}</td><td>{$voo['price']|number_format=###,2}</td><td>{$voo['pricetotal']|number_format=###,2}</td>
						</tr>
						</volist>
					</table>
				</td>
			</tr>
      		</volist>
      	</tbody>
    </table>

    <div class="btn"><input type="button" class="button" name="dosubmit" value="<?php echo L('delete')?>" onclick="myform.action='{:U($module_name.'/deleteall')}';return confirm_deleteall()"/><span>{$totalprice}</span></div>

</form></div>

<div id="pages" class="page">{$page}</div>
<script>
$("#catid").attr("value",'{$catid}');
function confirm_deleteall(){
	art.dialog.confirm("{:L('real_delete')}", function(){ $('#myform').submit();});
}
var isshow=Array();
function showsublist(index){
	if(isshow[index]){
		isshow[index]=false;
	}else{
		isshow[index]=true;
	}
	if(isshow[index]){
		$('#mo_'+index).show();
	}else{
		$('#mo_'+index).hide();
	}
}
</script>